/**
 * <(￣︶￣)>
 * @authors ZhouTing (243574263@qq.com)
 * @date    2018/1/17 16:10
 * @version $
 * Created by ZhouTing on 2018/1/17.
 */
function tostor() {
    var msg = arguments[0];//设置参数a的默认值为1
    var url = arguments[1] ? arguments[1] : "";//设置参数a的默认值为1
    var type = arguments[2] ? arguments[2] : false;//设置参数a的默认值为1
    /*提示弹框样式定义在style.css内*/
    $("body").append("<div class='bodymsg'><span>" + msg + "</span></div>");
    $(".bodymsg").stop(true,false).animate({"bottom":"15%"}, function () {
        setTimeout(function () {
            $(".bodymsg").stop().animate({"bottom":"0px",'opacity':'0'},300, function () {
                if (url == ""){
                    $(".bodymsg").remove();
                }else if(type){
                    window.location.replace(url) ;
                }else{
                    window.location.href = url
                }
            });
        }, 2000);
    });
}
var userdata = new UserStorge();
function UserStorge(){
    var users = localStorage.getItem("user");
    if(users!= null){
        this.mydata = function (txt) {
            var obj = JSON.parse(users);
            if(txt == 'uid'){
                return obj.uid;
            }else if(txt == 'headimg'){
                return obj.headimg;
            }else if(txt == 'phone'){
                return obj.phone;
            }else if(txt == 'token'){
                return obj.token;
            }else if(txt == 'uid'){
                return obj.uid;
            }else if(txt == 'password'){
                return obj.password;
            }else if(txt == 'key_token'){
                return obj.key_token;
            }else if(txt == 'agent_id'){
                return obj.agent_id;
            }else if(txt == 'link'){
                return obj.link;
            }
        }
    }else{
        return users;
    };
}
/*地址栏*/
function GetQueryString(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}